public class ExceptionDemo01 {
    public static void main(String[] args) {
//        int i = 100;
//        System.out.println(i / 0);

        /*
        Exception in thread "main" java.lang.ArithmeticException: / by zero
	    at ExceptionDemo01.main(ExceptionDemo01.java:4)
         */

//        int[] nums = new int[2];
//        nums[3] = 10;

        /*
        Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3
	at ExceptionDemo01.main(ExceptionDemo01.java:12)
         */

        Pig pig = new Pig();
        System.out.println(pig.color);
        pig = null;
        System.out.println(pig.weight);
        /*
            空指针异常
            Exception in thread "main" java.lang.NullPointerException
	at ExceptionDemo01.main(ExceptionDemo01.java:22)
         */
    }
}
